package com.thomasmoerman.dci3.tmc

import com.thomasmoerman.dci3.domain._

trait MoneySink {
	
  def increaseBalance(amount: Double)
  
  def updateLog(msg: String, amount: Double)

}

trait MoneySinkProvider {
  
  object MoneySinkConversion {
	implicit def convert(account: Account): MoneySink = asMoneySink(account)
  }
  
  def asMoneySink(account: Account): MoneySink
  
}

trait TransactionalMoneySinkProvider extends MoneySinkProvider {
  
  def asMoneySink(account: Account): MoneySink = new TransactionalMoneySink(account)

  class TransactionalMoneySink(account: Account) extends MoneySink {
	def increaseBalance(amount: Double) = account.increaseBalance(amount)
	
    def updateLog(msg: String, amount: Double) = account.updateLog(msg, amount)
  }
	
}